Skip to content

Fenrir fixes#554

Draft
embhorn wants to merge 1 commit into
wolfSSL:masterfrom
embhorn:fenrir_fixes
Draft

Fenrir fixes#554
embhorn wants to merge 1 commit into
wolfSSL:masterfrom
embhorn:fenrir_fixes

Conversation

@embhorn

@embhorn embhorn commented Jun 18, 2026

Copy link
Copy Markdown
Member
  • Fix f-3626: v5 MqttClient_Publish returns invalid success

@embhorn embhorn self-assigned this Jun 18, 2026
Copilot AI review requested due to automatic review settings June 18, 2026 20:48

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes issue f-3626 by ensuring MQTT v5 broker-side rejections of QoS>0 publishes are surfaced to callers (instead of incorrectly returning success), aligning the client’s publish behavior with how other v5 “ACK-but-rejected” flows are reported.

Changes:

  • Add a new return code MQTT_CODE_ERROR_PUBLISH_REJECTED for v5 QoS>0 PUBLISH rejections signaled via PUBACK/PUBREC/PUBCOMP reason codes (>= 0x80).
  • Update client publish handling to (a) stop QoS2 on PUBREC rejection (no illegal PUBREL) and (b) post-check PUBACK/PUBCOMP reason codes after the wait.
  • Add unit tests covering QoS1/QoS2 acceptance vs rejection cases (and a v3.1.1 guard).

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
wolfmqtt/mqtt_types.h Introduces the new MQTT_CODE_ERROR_PUBLISH_REJECTED return code.
wolfmqtt/mqtt_client.h Updates public API docs to mention the new publish rejection code (and adds a note about the write-only path).
src/mqtt_client.c Implements publish rejection detection for v5 PUBACK/PUBREC/PUBCOMP and adds string mapping for the new code.
tests/test_mqtt_client.c Adds regression tests validating correct return codes and QoS2 handshake behavior on v5 rejections.
ChangeLog.md Documents the behavior change and its implications for callers, including MT/write-only caveats.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread wolfmqtt/mqtt_client.h
Comment on lines +347 to +351
* \return MQTT_CODE_SUCCESS,
MQTT_CODE_ERROR_PUBLISH_REJECTED if a v5 broker rejected a
QoS>0 PUBLISH via a PUBACK (QoS 1) or PUBREC/PUBCOMP (QoS 2)
reason code >= 0x80 (see MqttPublish.resp.reason_code), or
MQTT_CODE_ERROR_* (see enum MqttPacketResponseCodes)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants